﻿using System;
using System.Runtime.InteropServices;

namespace GMusicBox
{
    class TreeView : System.Windows.Forms.TreeView
    {
        public TreeView()
        {
            base.HotTracking = true;
            base.ShowLines = false;
        }

        [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
        public static extern int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);

        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);
            if (Environment.OSVersion.Version.Major >= 6)
            {
                this.Font = new System.Drawing.Font("微软雅黑", 9);
                SetWindowTheme(base.Handle, "explorer", null);
            }
        }
    }
}
